package restful.struts2.app3;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import org.junit.*;

import restful.struts2.*;

public class TimeIT extends ProtocolIT {

	@BeforeClass
	public static void setUpClass() throws Exception {
		start("app3");
	}

	@Test
	public void testEchoProtocolIsDefined() throws Exception {
		GET("/protocol.txt");
		assertThat(status, is(equalTo(200)));
		assertThat(content, containsString("GET /time"));
		assertThat(content, containsString("GET /time/no-cache"));
	}

	@Test
	public void testGetTimeNoCache() throws Exception {
		GET("/time/no-cache.json");
		assertThat(status, is(equalTo(200)));
		assertThat(headers, hasHeader("Cache-Control", "no-cache"));
	}

	@Test
	public void testGetTime() throws Exception {
		GET("/time.json");
		assertThat(status, is(equalTo(200)));
		assertThat(headers, not(hasHeader("Cache-Control", "no-cache")));
	}

}